package com.bibi.zoo.web;

import com.bibi.zoo.service.HandleService;
import com.bibi.zoo.web.req.ReqBuy;
import com.bibi.zoo.web.req.ReqInput;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.swing.plaf.synth.SynthTextAreaUI;

@RestController
@RequestMapping("/demo")
public class DemoController {
    @Resource
    private HandleService handleService;

    @PostMapping("/getLuckkey")
    public String getLuckkey(@RequestBody ReqInput req) {
        handleService.getLuckkey(req);
        return "ok";
    }

    @PostMapping("/invite")
    public Object invite(@RequestBody ReqBuy req) {
        return handleService.inviteZoo(req);
    }

    @PostMapping("/buy")
    public Object buy(@RequestBody ReqBuy req) {
        handleService.buy(req, System.currentTimeMillis() + 3 * 60 * 1000);
        return "ok";
    }
}
